<? include("/inc/header.html") {} ?>

<div class="col-lg-12">
			<div class="panel" >
				<div class="form-body pal">
				<div style="padding-top: 2%; margin-right: auto; padding-bottom: 10px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">组名称
					<span class='require' id="bianhao">*</span></div>
                 </label>
				<div class="col-md-7">
					<div class="input-icon">
						<input id="name" type="text" class="form-control" datatype="*"/>
					</div>
				</div>
			</div>

			<div style="margin-right: auto; padding-bottom:10px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">组描述
					<span class='require' id="paixu">*</span></div>
                    </label>
				<div class="col-md-7">
					<div class="input-icon">
						<input id="description" type="text" class="form-control" />
					</div>
				</div>
			</div>
			
			<div style="margin-right: auto; padding-bottom: 54px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">父节点
					<span class='require' id="fuji"></span></div>
                                     </label>
				<div class="col-md-7">
					<div class="input-group input-group-sm mbs" >
						 <input id="parentclassname" type="text"  value="根目录" class="form-control" disabled="true" /> 
						 <input id="parentClassid" type="hidden" value="0" class="form-control" />
						<span class="input-group-btn"><button id="xuanze" onclick="saveclassZTree()" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择类..</button></span>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	var roupId = window.parent.getztreeId();
	var roupname = window.parent.getztreename();
	if(roupname !=null){
		$("#parentclassname").val(roupname);
		$("#parentClassid").val(roupId);
	}
	//选择父类
		function saveclassZTree() {
		parent.layer.open({
			type : 2,
			area : [ '400px', '400px' ],
			fix : false, //不固定
			scrollbar : false,
			shadeClose : true,
			//move : false,
			title:"选择节点",
			skin : 'layui-layer-rim', //加上边框
			btn : [ '保存 ', '关闭' ],
			content : ["knowledge-edit-data-usergroup-zTree.html?winName="+window.name, 'no'],
			yes : function(index,layer) {		
			var iframeWin = parent.window[layer.find('iframe')[0]['name']];
			  			  iframeWin.save();
			},
			cancel : function(index) {
			}
		});
	}
	
	function save() { 
	if( $("#name").val()==""){
			layer.msg('请输入组名称！');
		}else if($("#description").val() ==""){
			layer.msg('请输入组描述！');
		}else{  
		$.ajax({
			type : "post",
			url : "knowledgeEditDataRoleAddUserGroup.do",
			dataType : "json",
			data:{
				"name":$("#name").val(),
				"description":$("#description").val(),
				"parentClassid":$("#parentClassid").val()
			},
			beforeSend : function(XMLHttpRequest) {},
			success: function padlock() {  
           		 var index = parent.layer.getFrameIndex(window.name); 
           		 window.parent.initTree();
           		 parent.layer.msg('添加或编辑成功');
            	 parent.layer.close(index); 
    		}
			});
			}
    } 
</script>
